<?php

/**
 * This is the model class for table "{{task_item}}".
 *
 * The followings are the available columns in table '{{task_item}}':
 * @property integer $ptid
 * @property integer $today_extra
 * @property integer $time_spent
 * @property integer $ptstatus
 * @property integer $ptdateline
 * @property integer $ptupdated
 * @property string $pdid
 * @property integer $parent
 * @property string $job
 * @property string $type
 * @property integer $time
 * @property string $style
 * @property integer $pdstatus
 * @property integer $pddateline
 * @property integer $pdupdated
 * @property integer $id
 * @property string $username
 * @property string $pname
 * @property string $position
 * @property integer $power
 * @property integer $taskid
 * @property string $tcode
 * @property string $subcode
 * @property string $office
 * @property string $task
 * @property string $tco
 * @property string $sco
 * @property integer $urgency
 * @property string $group
 * @property string $follow_up_date
 * @property string $follow_up_person
 */
class TaskItem extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return TaskItem the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return '{{task_item}}';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('job, type, time, username, pname, position', 'required'),
			array('ptid, today_extra, time_spent, ptstatus, ptdateline, ptupdated, parent, time, pdstatus, pddateline, pdupdated, id, power, taskid, urgency', 'numerical', 'integerOnly'=>true),
			array('pdid', 'length', 'max'=>8),
			array('job, pname, position, tcode, subcode, office, follow_up_person', 'length', 'max'=>100),
			array('type, style', 'length', 'max'=>5),
			array('username, task', 'length', 'max'=>255),
			array('tco, sco', 'length', 'max'=>50),
			array('group', 'length', 'max'=>11),
			array('follow_up_date', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('ptid, today_extra, time_spent, ptstatus, ptdateline, ptupdated, pdid, parent, job, type, time, style, pdstatus, pddateline, pdupdated, id, username, pname, position, power, taskid, tcode, subcode, office, task, tco, sco, urgency, group, follow_up_date, follow_up_person', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'ptid' => 'Ptid',
			'today_extra' => 'Today Extra',
			'time_spent' => 'Time Spent',
			'ptstatus' => 'Ptstatus',
			'ptdateline' => 'Ptdateline',
			'ptupdated' => 'Ptupdated',
			'pdid' => 'Pdid',
			'parent' => 'Parent',
			'job' => 'Job',
			'type' => 'Type',
			'time' => 'Time',
			'style' => 'Style',
			'pdstatus' => 'Pdstatus',
			'pddateline' => 'Pddateline',
			'pdupdated' => 'Pdupdated',
			'id' => 'ID',
			'username' => 'Username',
			'pname' => 'Pname',
			'position' => 'Position',
			'power' => 'Power',
			'taskid' => 'Taskid',
			'tcode' => 'Tcode',
			'subcode' => 'Subcode',
			'office' => 'Office',
			'task' => 'Task',
			'tco' => 'Tco',
			'sco' => 'Sco',
			'urgency' => 'Urgency',
			'group' => 'Group',
			'follow_up_date' => 'Follow Up Date',
			'follow_up_person' => 'Follow Up Person',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('ptid',$this->ptid);
		$criteria->compare('today_extra',$this->today_extra);
		$criteria->compare('time_spent',$this->time_spent);
		$criteria->compare('ptstatus',$this->ptstatus);
		$criteria->compare('ptdateline',$this->ptdateline);
		$criteria->compare('ptupdated',$this->ptupdated);
		$criteria->compare('pdid',$this->pdid,true);
		$criteria->compare('parent',$this->parent);
		$criteria->compare('job',$this->job,true);
		$criteria->compare('type',$this->type,true);
		$criteria->compare('time',$this->time);
		$criteria->compare('style',$this->style,true);
		$criteria->compare('pdstatus',$this->pdstatus);
		$criteria->compare('pddateline',$this->pddateline);
		$criteria->compare('pdupdated',$this->pdupdated);
		$criteria->compare('id',$this->id);
		$criteria->compare('username',$this->username,true);
		$criteria->compare('pname',$this->pname,true);
		$criteria->compare('position',$this->position,true);
		$criteria->compare('power',$this->power);
		$criteria->compare('taskid',$this->taskid);
		$criteria->compare('tcode',$this->tcode,true);
		$criteria->compare('subcode',$this->subcode,true);
		$criteria->compare('office',$this->office,true);
		$criteria->compare('task',$this->task,true);
		$criteria->compare('tco',$this->tco,true);
		$criteria->compare('sco',$this->sco,true);
		$criteria->compare('urgency',$this->urgency);
		$criteria->compare('group',$this->group,true);
		$criteria->compare('follow_up_date',$this->follow_up_date,true);
		$criteria->compare('follow_up_person',$this->follow_up_person,true);

		return new CActiveDataProvider(get_class($this), array(
			'criteria'=>$criteria,
		));
	}
}